UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5qDOADam+G46WSAY7OkV0TEvYzVzez1d7dMCVh7sMHY='
WHERE
key_id = '6871f0587327f10fc968c3f73f134e3604870a97aa7c7c3c55c792cb449e7500'
AND (
token = '5qDOADam+G46WSAY7OkV0TEvYzVzez1d7dMCVh7sMHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)