UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hHYr9+3nUSmuudNsyJnkWCrvqFpCmvPvSvKicAw2YUA='
WHERE
key_id = 'ecd437b741c7149c3e206ccc7beffdfce7b5f3e5e0e0af5b4567b04ea918f70f'
AND (
token = 'hHYr9+3nUSmuudNsyJnkWCrvqFpCmvPvSvKicAw2YUA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)