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

Query time 0.00035