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