UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TNypXBuLMTFORWEnop9tCmKsNM+SaiTamUWAzfl9sR4=' 
WHERE 
  key_id = 'b1fdffea2f0d697e3e833f3c51fa1b38bbe5b351392a07a987bb4a2d6b46d88d' 
  AND (
    token = 'TNypXBuLMTFORWEnop9tCmKsNM+SaiTamUWAzfl9sR4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036