UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X8DDhgevu6mQ400n9ONk/B2SjL3JgDPJX7XS9rVH8/Q=' 
WHERE 
  key_id = 'e10b0c03932872e34341123520b511d54fc769d5f567c0ed3258f3fa73fc2a1a' 
  AND (
    token = 'X8DDhgevu6mQ400n9ONk/B2SjL3JgDPJX7XS9rVH8/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038