UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JrYcT78O9Ssj5ykMvX6vdLepHS3ruYBbwoK/tiCHies=' 
WHERE 
  key_id = '7417cef35d4b7589e3c8523632c251593df7a6b0b43536263baf905f74393d94' 
  AND (
    token = 'JrYcT78O9Ssj5ykMvX6vdLepHS3ruYBbwoK/tiCHies=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033