UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZJpqsKb79ekZ8OhA7xddcXtHJjh25rZs6m2zNtDImws=' 
WHERE 
  key_id = '22c41960301524e264af03dab97ec4e7fd1724363245435e069a4394114b567d' 
  AND (
    token = 'ZJpqsKb79ekZ8OhA7xddcXtHJjh25rZs6m2zNtDImws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032