UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '54AfpizqXtt7bb44i52XYpddKJGYz3wv3YVfv94ScXA='
WHERE
key_id = 'a6facf56a36f15edc1f920d8f34e16a9ea7d253551e990e73f88c8881a0f1ed3'
AND (
token = '54AfpizqXtt7bb44i52XYpddKJGYz3wv3YVfv94ScXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)