UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwyLCEhMtImovKzkXxucneGK4+QXO7wvbsfnLvuSUtU=' 
WHERE 
  key_id = '3bac1466e018d5b295b1dd967256f88b9bbdeee80dbc521211aa1dffa11fb9ae' 
  AND (
    token = 'AwyLCEhMtImovKzkXxucneGK4+QXO7wvbsfnLvuSUtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029