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