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