UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NT3SluacwRqYBeYS1lHhRGVHVUPDWrQ9df3frzRYfU8='
WHERE
key_id = '963e09daa5831ae8ae3e15c10db4c6cc2ed5b0cb5598efdfaf676cfd309e08ac'
AND (
token = 'NT3SluacwRqYBeYS1lHhRGVHVUPDWrQ9df3frzRYfU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)