UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WMdm96fH5mRS88l5noEqNLfT0KHsdk6xUZ7E4gf1Qnw=' 
WHERE 
  key_id = '27b2e1a869cd7595bc070ea65f6adcfed435c51bf96dc65bda6ef9d10c857916' 
  AND (
    token = 'WMdm96fH5mRS88l5noEqNLfT0KHsdk6xUZ7E4gf1Qnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029