UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BrrttQE2XsKB/Nj2dijoqW1EmczJ0JPwmrK5aO+X9U0=' 
WHERE 
  key_id = 'f14598d38c55a2b54201fa5051d38bdb77aeedfd327bb8d32532daf065d2892d' 
  AND (
    token = 'BrrttQE2XsKB/Nj2dijoqW1EmczJ0JPwmrK5aO+X9U0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041