UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YSXEKwKMaWnCDrs9sugexrZJ/u3AiVUzEqMWLZW+AvI='
WHERE
key_id = '794f896215f7af27491854395bc161cda58922af2d407d9d5b086e3a9f840c39'
AND (
token = 'YSXEKwKMaWnCDrs9sugexrZJ/u3AiVUzEqMWLZW+AvI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)