UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jp7cxmPzTld+f34Z/kCvg/DcFMeW+WjCTs73US84hD8=' 
WHERE 
  key_id = '315d68e496f2170c31ab875b0d153103baaabbb483fef3a89fa59e2257187663' 
  AND (
    token = 'Jp7cxmPzTld+f34Z/kCvg/DcFMeW+WjCTs73US84hD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036