UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lbX54F0NK4zm2vVIIwUCUaiO24S1/8N/4r0/6a4+2X0=' 
WHERE 
  key_id = '3bca7cd2d4d61afa3563d903592050d5515497c1887e649aa4ec22cfe57f5f98' 
  AND (
    token = 'lbX54F0NK4zm2vVIIwUCUaiO24S1/8N/4r0/6a4+2X0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038