UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QwV05bjbMfQRY7Tzd9huYvWZlgDaO3o9mwcLoeGvrAA='
WHERE
key_id = 'c83378fe0e57e6eaa722c9c9455b3a5b7d941c647bd57664c2fd731c71732d05'
AND (
token = 'QwV05bjbMfQRY7Tzd9huYvWZlgDaO3o9mwcLoeGvrAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)