UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5lPEoP40HND/vii5g1KtSmjSuTzCjJVRFn4Y8sqsLQc='
WHERE
key_id = 'b31cb7f31e6ca0557d56a4dafda0ea639f483176ece101a5ff76588ecfad72dc'
AND (
token = '5lPEoP40HND/vii5g1KtSmjSuTzCjJVRFn4Y8sqsLQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)