UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'md+jMtrPpBVxp5OHR5SaGwZBoTSX36ScZnGJQ99q0l4='
WHERE
key_id = 'e66379523daa192c1f042b77dcfd0196fed2906dff2eb48611a91d288b3d91f4'
AND (
token = 'md+jMtrPpBVxp5OHR5SaGwZBoTSX36ScZnGJQ99q0l4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)