UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '82U63uWbRtd33jJ1JLiMIiMG7FOV3HAoGcZoL+fRrHw='
WHERE
key_id = 'f8ef0abc33030fa82e437f6c380d51d203178506591decfab2c5599ecc298da4'
AND (
token = '82U63uWbRtd33jJ1JLiMIiMG7FOV3HAoGcZoL+fRrHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)