UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1r31aD1TWQMoY5nigIzdmSDy99b0fFf2J71/uWtNzvM=' 
WHERE 
  key_id = '25fb96b4b4ef50f72158290e76992f690ec4c9dcd80016ac8808b2f83c36fd50' 
  AND (
    token = '1r31aD1TWQMoY5nigIzdmSDy99b0fFf2J71/uWtNzvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053