UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kkuHO4xuMu1EDtNMSLpgovJeCjo8ewn2PelkQenWmyw=' 
WHERE 
  key_id = 'd3639929143192f3a469dec4e6786497573f957ce95757d01590b4be3f6acd1d' 
  AND (
    token = 'kkuHO4xuMu1EDtNMSLpgovJeCjo8ewn2PelkQenWmyw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037