UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h/17tcHjRkRgIkYcC6pr1Cjy7dyJtOG1bS+IyfIP+ac=' 
WHERE 
  key_id = '51715902b42122e866afa3901e7e8c939062e7fb25089d027b59756a587a67a9' 
  AND (
    token = 'h/17tcHjRkRgIkYcC6pr1Cjy7dyJtOG1bS+IyfIP+ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00129