UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7LB4A2v5xhtRmX3DTmm0Ffjs8sYC1VsRI2kxXg0r5yw=' 
WHERE 
  key_id = 'b1f7b353305bef052e79517209d988e55fb6d85feb5d96fdba735457ee1ea198' 
  AND (
    token = '7LB4A2v5xhtRmX3DTmm0Ffjs8sYC1VsRI2kxXg0r5yw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029