UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z3UCT9lOk4FLW6CVHSJi+iV6zkGWizy/htAq5w5n+BI='
WHERE
key_id = '89ebbfe9d6bedd62e299d7a73af3fed27be50e822649ed4927ca33fcd74acc7b'
AND (
token = 'Z3UCT9lOk4FLW6CVHSJi+iV6zkGWizy/htAq5w5n+BI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)