UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9YqW05nKI0JLuCHG8m83RqWwTo2IHVULTmcD8IhUuuY='
WHERE
key_id = '209b7fc598e729e893c9557b66ed2a54ea5ddcab1fe45088552d51846cdaeea2'
AND (
token = '9YqW05nKI0JLuCHG8m83RqWwTo2IHVULTmcD8IhUuuY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)