UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9g9LhU+JRKudcIDBsnA0yYNJRBVoPhaJRdg+jNtYRAs='
WHERE
key_id = '4cc772ccb34cc9683edba793d84daa08442635eb7ac7606c0a673064a3bc00cd'
AND (
token = '9g9LhU+JRKudcIDBsnA0yYNJRBVoPhaJRdg+jNtYRAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)