UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hg3HE2S7D8F4F7FRU3l5MOesDmJ/p+h1aud9Ml1fjdo=' 
WHERE 
  key_id = 'b81caf0b408fd1a0fab081dceddf08e90b52d2c7002f697154056abeaf447d89' 
  AND (
    token = 'Hg3HE2S7D8F4F7FRU3l5MOesDmJ/p+h1aud9Ml1fjdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028