UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lC/Jhrn4IBDCxcV5S4KagdGBO5hFsMnphleGabssnjM=' 
WHERE 
  key_id = '8cacad327baf34b2565d174c424710a2d63e2ce17d132a981ad65c330d591f79' 
  AND (
    token = 'lC/Jhrn4IBDCxcV5S4KagdGBO5hFsMnphleGabssnjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042