UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oJXUD7REs1ebQlFzv909t/jvJ6J+VMyMQ1M5jOXBY5w=' 
WHERE 
  key_id = 'f4dc384eaf1f66e268471e616d053d3735508081a0093d07a38864b4022f8011' 
  AND (
    token = 'oJXUD7REs1ebQlFzv909t/jvJ6J+VMyMQ1M5jOXBY5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032