UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N3ggMW5AjD1NPgr8dOjfwOW/4ZEyPRdcCayjoC/td9Y=' 
WHERE 
  key_id = 'a9e2d36a604c3264f6152d1b37430103cf1070935d47f09d34743449d3813819' 
  AND (
    token = 'N3ggMW5AjD1NPgr8dOjfwOW/4ZEyPRdcCayjoC/td9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030