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