UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kwOtkia3MzRP5VEv0TcOZa5PflA6kxroS7+qdkUAwIw='
WHERE
key_id = 'ccb540dafed48164d83900f3be0a677578c2f1a32a4e4c34146fd56e62b43c99'
AND (
token = 'kwOtkia3MzRP5VEv0TcOZa5PflA6kxroS7+qdkUAwIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)