UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rPH1hYhOnIR7tNjLo6Vz5l/zCrOdiM1x9wB65V+rZuY=' 
WHERE 
  key_id = 'f076bd227e26d322f31d0410d1f99f23ccfd3f48d49bb826de8b376e38f83715' 
  AND (
    token = 'rPH1hYhOnIR7tNjLo6Vz5l/zCrOdiM1x9wB65V+rZuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026