UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3eSxZEANjFHmCz7rQc9vzF0zp+bhArZ/B8nmhRmNodk='
WHERE
key_id = 'b78f13536853ef327ec73c46403919a93fb6c3e987a4f69ffd28eb0d9af6a4cd'
AND (
token = '3eSxZEANjFHmCz7rQc9vzF0zp+bhArZ/B8nmhRmNodk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)