UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xNgZpvsdnGrhsfYoNEaUGuY78ZgxYFsYssE7TRByxT8='
WHERE
key_id = '1404432a0b107b54ec1a33616b044a21de7298c7590195655eb66ea03613b405'
AND (
token = 'xNgZpvsdnGrhsfYoNEaUGuY78ZgxYFsYssE7TRByxT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)